load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

OTEL_TARGET_COMPATIBLE_WITH = select({
    "//bazel/config:build_otel_enabled": [],
    "//conditions:default": ["@platforms//:incompatible"],
})

exports_files(
    glob(["*.h"]) + glob(["*.cpp"]),
)

mongo_cc_library(
    name = "otel_base",
    srcs = [
        "telemetry_context_holder.cpp",
    ],
    deps = [
        "//src/mongo/db:server_base",
    ],
)

mongo_cc_library(
    name = "otel_internal",
    srcs = [
    ],
    target_compatible_with = OTEL_TARGET_COMPATIBLE_WITH,
    deps = [
        ":otel_base",
        "//src/mongo/otel/traces:tracing",
    ],
)

mongo_cc_library(
    name = "otel",
    deps = [
        ":otel_base",
    ] + select(
        {
            "@//bazel/config:build_otel_enabled": [
                ":otel_internal",
            ],
            "//conditions:default": [],
        },
    ),
)
